package crm.view.popup;

import java.awt.Component;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JInternalFrame;
import javax.swing.JMenuItem;
import javax.swing.JPopupMenu;
import javax.swing.border.BevelBorder;

import crm.model.teacherPC.net.PcWindow;
import crm.model.teacherPC.net.StudentPC;
import crm.view.desktop.StudentDesktopPane;



public class DesktopPopup extends JPopupMenu implements ActionListener {
	private static DesktopPopup popup;

	private StudentDesktopPane desktop = null;
	static {
		popup = new DesktopPopup();
	}
	public static void show(StudentDesktopPane desktop, Component c, int x, int y){
		popup.showPopUp(desktop, c, x, y);
	}
	public void showPopUp(StudentDesktopPane desktop,  Component c, int x, int y){
		this.desktop = desktop;
		 show(c,x,y);
	}
	public DesktopPopup() {
		setBorder(new BevelBorder(BevelBorder.RAISED));
		JMenuItem item = new JMenuItem("Alle anzeigen");
		item.addActionListener(this);
		add(item);
		item = new JMenuItem("Neu Anornen");
		item.addActionListener(this);
		add(item);
	}

	public void actionPerformed(ActionEvent ev) {
		if (ev.getActionCommand().equals("Alle anzeigen")) {
			desktop.refresh();
		}else if (ev.getActionCommand().equals("Neu Anornen")) {
			desktop.newOrder();
		}

	}
}
